package com.springboot.test.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum MessageTypeEnum {
    PUBLISH(0,"用户发布商品通知"),
    AUDIT(1,"用户商品审核通过通知"),
    UN_AUDIT(2,"用户商品未通过审核结果通知"),
    UN_PUBLISH(3,"用户下架商品通知"),
    RE_PUBLISH(4,"用户重新上架商品通知"),
    TRADE(5,"用户完成交易通知"),
    PAY(6,"商品已被支付通知"),
    PAY_BACK(7,"商品退款通知"),
    USER_PAY_BACK(8,"用户商品退款通知"),
    TRADE_DONE(9,"商品完成交易通知"),
    PAY_DONE(10,"商品完成退款通知"),
    ;
    Integer code;
    String describe;
    public static MessageTypeEnum getByCode(Integer code){
        if(null == code){
            return null;
        }
        for (MessageTypeEnum value : MessageTypeEnum.values()) {
            if(code.equals(value.getCode())){
                return value;
            }
        }
        return null;
    }
}
